package cn.itcast.controller;

import cn.itcast.bean.HotWords;
import cn.itcast.service.IDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description :
 * @Auther : zj
 * @Date : 2019/1/17 10:15
 */
@Controller
@RequestMapping
public class DubboDemoController {

    @Autowired(required = false)
    private IDemoService demoService;


    @RequestMapping("/test.do")
    @ResponseBody
    public String test() {
        System.out.println("请求");

        return demoService.test();
    }

    @RequestMapping("/testOne")
    @ResponseBody
    public List<HotWords> testOne(@RequestBody List<String> list) {
        System.out.println("请求二");

        return demoService.hotwordsListByConf(list);
    }

    @RequestMapping("/testTwo/{ids}")
    @ResponseBody
    public List<HotWords> testTwo(@PathVariable Integer ids) {
        System.out.println("请求二");
        return demoService.hotwordsList(ids);
    }



    @RequestMapping("/get/{key}")
    @ResponseBody
    public String get(@PathVariable String key) {
        return demoService.getRedis(key);
    }
}
